#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <ctime>
#include <queue>
#include <algorithm>

#define FOR(i,a,n) for(int i=a,_n(n);i<_n;++i)
#define REP(i,n) FOR(i,0,n)

const double PI = acos(-1.0);

using namespace std;

double RandExp()
{
    return 1.0*rand()/RAND_MAX;
}

class Point
{
public:
    double x,y;
    Point(double a=0,double b=0):x(a),y(b){}
    double Dist(const Point& pb)
    {
        double tx = x - pb.x;
        double ty = y - pb.y;
        return sqrt(tx*tx+ty*ty);
    }
    double Cal(const vector<Point>& hole)
    {
        double res = 1e9;
        REP(i,hole.size())
        {
            res = min(res,Dist(hole[i]));
        }
        return res;
    }
    Point RandMove(double r)
    {
        double dx = PI*RandExp();
        double dy = PI*RandExp()-0.5*PI;
        return Point(x+r*cos(dx),y+r*sin(dy));
    }
};

void PrintAns(int w,int h,const vector<Point>& hole)
{
    Point ans;
    double aw=-1;
    vector<Point> p;
    p.push_back(Point(0,0));
    p.push_back(Point(w,h));
    p.push_back(Point(0,h));
    p.push_back(Point(w,0));
    p.push_back(Point(w/2.0,h/2.0));
    vector<double> dist(p.size(),-1);
    double r = sqrt(w*w+h*h)/2;
    const double MAX_R = r;
    const int L = 100;
    const double EPS = 1e-3;
    while(r>EPS)
    {
        REP(pi,p.size())
        {
            REP(i,L)
            {
                Point pt = p[pi].RandMove(r);
                if(pt.x<0||pt.y<0||pt.x>w||pt.y>h) continue;
                double dt = pt.Cal(hole);
                double gp = dt>dist[pi]?1:(r/MAX_R);
                if(RandExp()<gp)
                {
                    p[pi] = pt;
                    dist[pi]=dt;
                }
                if(dt>aw)
                {
                    ans = p[pi];
                    aw = dt;
                }
            }
        }
        r *= 0.8;
    }
    printf("The safest point is (%.1f, %.1f).\n",ans.x,ans.y);

}

int main()
{
    srand(3);
    int T;
    cin>>T;
    while(T--)
    {
        int x,y,m;
        cin>>x>>y>>m;
        vector<Point> hole(m);
        REP(i,m) cin>>hole[i].x>>hole[i].y;
        PrintAns(x,y,hole);
    }
	return 0;
}
